package pub.zhouhui.services.Monitor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Created by shane on 16-11-16.
 */
@Component
public class MonitorFunction {

    @Autowired
    MonitorController monitorController;

    public void createNewThread(String name) {
        new Thread() {
            @Override
            public void run() {
                while (true) {
                    if (!monitorController.getMontitorHashMapValue(name)) {
                        System.out.println("监控结束");
                        break;
                    }
                    System.out.println(name);
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }.start();
    }
}
